import java.util.ArrayList;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/3/19
 */
import java.util.Scanner;
import java.util.Arrays;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Demo6 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int[] A = new int[n];
        Arrays.sort(A);
        int[] B = new int[n];
        Arrays.sort(B);
        int[] C = new int[n];
        Arrays.sort(C);
        for(int i = 0; i < n; i++){
            A[i] = scan.nextInt();
        }
        for(int i = 0; i < n; i++){
            B[i] = scan.nextInt();
        }
        for(int i = 0; i < n; i++){
            C[i] = scan.nextInt();
        }
        int res = 0;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                for(int k = 0; k < n; k++){
                    if(A[i] < B[j] && B[j] < C[k]){
                        res++;
                    }else{
                        break;
                    }
                }
            }
        }
        System.out.println(res);



        scan.close();
    }
}